package com.example.aerospacemanagementsystem.controller.basic;

import com.example.aerospacemanagementsystem.entity.basic.Role;
import com.example.aerospacemanagementsystem.service.basicService.RoleService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 铁殷
 */
@Api(tags = "角色")
@RestController
@CrossOrigin
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    //添加角色
    @PostMapping
    public int add(@RequestBody Role role){
        return roleService.add(role);
    }
    //删除角色
    @DeleteMapping
    public int delete(Role role){
        return roleService.delete(role);
    }
    //修改角色
    @PutMapping
    public int update(@RequestBody Role role){
        return roleService.update(role);
    }
    //获取角色
    @GetMapping("/getAll")
    public List<Role> getAllCity(Role role) {
        List<Role> list = roleService.getAllRole(role);
        return list;
    }
}
